const getElement = function(id){
    var object = [];
    var leng = 0;
    //console.log("=========测试获取label===========");
    var element= document.getElementById(id);
    var label = element.getElementsByTagName("label");
    //console.log(label);
    for(var i=0 ;i<label.length; i++){

      if(label[i].parentElement.getElementsByTagName("input").length > 0){
        var temp = label[i].parentElement.getElementsByTagName("input")[0];

        var j = {};
        j.title = label[i].innerText;
        j.value = temp.value;
        j.type = 0;

        object.push(j);
      }else if(label[i].parentElement.getElementsByTagName("textarea").length>0){
        var temp = label[i].parentElement.getElementsByTagName("textarea")[0];

        var j = {};
        j.title = label[i].innerText;
        j.value = temp.value;
        j.type = 1;

        object.push(j);
      }
    }

    var len = object.length;
    leng = Math.ceil((len/3));

    var json = {};
    json.object = object;
    json.length = leng;

    return json;
}

export default {
  getElement: getElement
}
